//
//  dingdanViewController.m
//  个人信息
//
//  Created by IOSchengxuyuan on 15/11/28.
//  Copyright (c) 2015年 com.ppfur. All rights reserved.
//

#import "dingdanViewController.h"

@interface dingdanViewController (){
    float aa,bb;
    float width,height;
    UITableViewCell*cell;
}

@end

@implementation dingdanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _mytable.delegate=self;
    _mytable.dataSource=self;
    width=[UIScreen mainScreen].bounds.size.width;
    height=[UIScreen mainScreen].bounds.size.height;
    aa=width/320;
    bb=height/568;
    if(width==320){
        _mytable.frame=CGRectMake(0, 64*bb, width, height-130);
    }else if(width==375){
        _mytable.frame=CGRectMake(0, 41*bb, width, height-170);
    }else{
        _mytable.frame=CGRectMake(0,40*bb, width, height-210);
        
    }
    _va1.frame=CGRectMake(width/4, 0, 1, 45);
    _va2.frame=CGRectMake(width/2, 0, 1, 45);
    _va3.frame=CGRectMake(3*width/4, 0, 1, 45);
    _ba1.frame=CGRectMake(0, 5, width/4-10, 31);
    _ba2.frame=CGRectMake(width/4, 5, width/4, 31);
    _ba3.frame=CGRectMake(width/2, 5, width/4, 31);
    _b4.frame=CGRectMake(3*width/4, 5, width/4, 31);
    //    NSLog(@"%f",height);
    //    _mytable.scrollEnabled=YES;
    _mytable.showsVerticalScrollIndicator = YES;
    // Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 140;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 5;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *id=@"row";
    cell=[tableView dequeueReusableCellWithIdentifier:id];
    if (cell==nil)
    {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:id];
    }
    NSArray *row1=[cell.contentView subviews];
    //    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    for (UIView *vv2 in row1)
    {
        [vv2 removeFromSuperview];
    }
    if(width==320){
        UILabel*ll1=[[UILabel alloc] initWithFrame:CGRectMake(15, 10, 200, 20)];
        ll1.text=@"订单号:26746531852162";
        ll1.textColor=[UIColor redColor];
        ll1.font=[UIFont systemFontOfSize:13.0f];
        [cell.contentView addSubview:ll1];
        UILabel*ll2=[[UILabel alloc] initWithFrame:CGRectMake(270, 10, 100, 20)];
        ll2.text=@"待付款";
        ll2.textColor=[UIColor redColor];
        ll2.font=[UIFont systemFontOfSize:12.0f];
        [cell.contentView addSubview:ll2];
        UIView*vvv1=[[UIView alloc] initWithFrame:CGRectMake(0, 35, 320, 1)];
        vvv1.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [cell.contentView addSubview:vvv1];
        UIImageView*ii1=[[UIImageView alloc] initWithFrame:CGRectMake(10, 42, 60, 60)];
        ii1.image = [UIImage imageNamed:@"dd2.jpg"];
        [cell.contentView addSubview:ii1];
        [cell.contentView addSubview:ll2];
        UIView*vvv2=[[UIView alloc] initWithFrame:CGRectMake(0, 110, 320, 1)];
        vvv2.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [cell.contentView addSubview:vvv2];
        UILabel*ll3=[[UILabel alloc] initWithFrame:CGRectMake(15, 115, 100, 20)];
        ll3.text=@"￥1420.00";
        ll3.textColor=[UIColor redColor];
        ll3.font=[UIFont systemFontOfSize:15.0f];
        [cell.contentView addSubview:ll3];
        UILabel*ll4=[[UILabel alloc] initWithFrame:CGRectMake(80, 40, 300, 20)];
        ll4.text=@"女款时尚旅行包专门为女性打造的一款手提包";
        ll4.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll4];
        UILabel*ll5=[[UILabel alloc] initWithFrame:CGRectMake(80, 57, 100, 20)];
        ll5.text=@"数量:1";
        ll5.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll5];
        UILabel*ll6=[[UILabel alloc] initWithFrame:CGRectMake(80, 74, 100, 20)];
        ll6.text=@"备注:发货快一点";
        ll6.textColor=[UIColor lightGrayColor];
        ll6.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll6];
        UIButton*bb1=[[UIButton alloc] initWithFrame:CGRectMake(175, 115, 80, 20)];
        [bb1 setTitle:@"取消订单" forState:UIControlStateNormal];
        [bb1 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        bb1.titleLabel.font = [UIFont systemFontOfSize: 14.0];
        [bb1.layer setBorderWidth:1.0]; //边框宽度
        [bb1.layer setBorderColor:[[UIColor blackColor]CGColor]];//边框颜色
        UIButton*bb2=[[UIButton alloc] initWithFrame:CGRectMake(260, 115, 50, 20)];
        bb2.titleLabel.font=[UIFont systemFontOfSize:14.0f];
        [bb2 setTitle:@"付款" forState:UIControlStateNormal];
        [bb2 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        [bb2.layer setBorderWidth:1.0]; //边框宽度
        [bb2.layer setBorderColor:[[UIColor redColor]CGColor]];
        [cell.contentView addSubview:bb1];
        [cell.contentView addSubview:bb2];
    }else if(width==375){
        UILabel*ll1=[[UILabel alloc] initWithFrame:CGRectMake(15, 10, 200, 20)];
        ll1.text=@"订单号:26746531852162";
        ll1.textColor=[UIColor redColor];
        ll1.font=[UIFont systemFontOfSize:13.0f];
        [cell.contentView addSubview:ll1];
        UILabel*ll2=[[UILabel alloc] initWithFrame:CGRectMake(310, 10, 100, 20)];
        ll2.text=@"待付款";
        ll2.textColor=[UIColor redColor];
        ll2.font=[UIFont systemFontOfSize:12.0f];
        [cell.contentView addSubview:ll2];
        UIView*vvv1=[[UIView alloc] initWithFrame:CGRectMake(0, 35, width, 1)];
        vvv1.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [cell.contentView addSubview:vvv1];
        UIImageView*ii1=[[UIImageView alloc] initWithFrame:CGRectMake(10, 42, 60, 60)];
        ii1.image = [UIImage imageNamed:@"dd2.jpg"];
        [cell.contentView addSubview:ii1];
        [cell.contentView addSubview:ll2];
        UIView*vvv2=[[UIView alloc] initWithFrame:CGRectMake(0, 110, width, 1)];
        vvv2.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [cell.contentView addSubview:vvv2];
        UILabel*ll3=[[UILabel alloc] initWithFrame:CGRectMake(15, 115, 100, 20)];
        ll3.text=@"￥1420.00";
        ll3.textColor=[UIColor redColor];
        ll3.font=[UIFont systemFontOfSize:15.0f];
        [cell.contentView addSubview:ll3];
        UILabel*ll4=[[UILabel alloc] initWithFrame:CGRectMake(80, 40, 300, 20)];
        ll4.text=@"女款时尚旅行包专门为女性打造的一款手提包";
        ll4.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll4];
        UILabel*ll5=[[UILabel alloc] initWithFrame:CGRectMake(80, 57, 100, 20)];
        ll5.text=@"数量:1";
        ll5.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll5];
        UILabel*ll6=[[UILabel alloc] initWithFrame:CGRectMake(80, 74, 100, 20)];
        ll6.text=@"备注:发货快一点";
        ll6.textColor=[UIColor lightGrayColor];
        ll6.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll6];
        UIButton*bb1=[[UIButton alloc] initWithFrame:CGRectMake(230, 115, 80, 20)];
        [bb1 setTitle:@"取消订单" forState:UIControlStateNormal];
        [bb1 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        bb1.titleLabel.font = [UIFont systemFontOfSize: 14.0];
        [bb1.layer setBorderWidth:1.0]; //边框宽度
        [bb1.layer setBorderColor:[[UIColor blackColor]CGColor]];//边框颜色
        UIButton*bb2=[[UIButton alloc] initWithFrame:CGRectMake(315, 115, 50, 20)];
        bb2.titleLabel.font=[UIFont systemFontOfSize:14.0f];
        [bb2 setTitle:@"付款" forState:UIControlStateNormal];
        [bb2 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        [bb2.layer setBorderWidth:1.0]; //边框宽度
        [bb2.layer setBorderColor:[[UIColor redColor]CGColor]];
        [cell.contentView addSubview:bb1];
        [cell.contentView addSubview:bb2];
    }else{
        UILabel*ll1=[[UILabel alloc] initWithFrame:CGRectMake(15, 10, 200, 20)];
        ll1.text=@"订单号:26746531852162";
        ll1.textColor=[UIColor redColor];
        ll1.font=[UIFont systemFontOfSize:13.0f];
        [cell.contentView addSubview:ll1];
        UILabel*ll2=[[UILabel alloc] initWithFrame:CGRectMake(330, 10, 100, 20)];
        ll2.text=@"待付款";
        ll2.textColor=[UIColor redColor];
        ll2.font=[UIFont systemFontOfSize:12.0f];
        [cell.contentView addSubview:ll2];
        UIView*vvv1=[[UIView alloc] initWithFrame:CGRectMake(0, 35, width, 1)];
        vvv1.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [cell.contentView addSubview:vvv1];
        UIImageView*ii1=[[UIImageView alloc] initWithFrame:CGRectMake(10, 42, 60, 60)];
        ii1.image = [UIImage imageNamed:@"dd2.jpg"];
        [cell.contentView addSubview:ii1];
        [cell.contentView addSubview:ll2];
        UIView*vvv2=[[UIView alloc] initWithFrame:CGRectMake(0, 110, width, 1)];
        vvv2.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [cell.contentView addSubview:vvv2];
        UILabel*ll3=[[UILabel alloc] initWithFrame:CGRectMake(15, 115, 100, 20)];
        ll3.text=@"￥1420.00";
        ll3.textColor=[UIColor redColor];
        ll3.font=[UIFont systemFontOfSize:15.0f];
        [cell.contentView addSubview:ll3];
        UILabel*ll4=[[UILabel alloc] initWithFrame:CGRectMake(80, 40, 300, 20)];
        ll4.text=@"女款时尚旅行包专门为女性打造的一款手提包";
        ll4.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll4];
        UILabel*ll5=[[UILabel alloc] initWithFrame:CGRectMake(80, 57, 100, 20)];
        ll5.text=@"数量:1";
        ll5.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll5];
        UILabel*ll6=[[UILabel alloc] initWithFrame:CGRectMake(80, 74, 100, 20)];
        ll6.text=@"备注:发货快一点";
        ll6.textColor=[UIColor lightGrayColor];
        ll6.font=[UIFont systemFontOfSize:11.0f];
        [cell.contentView addSubview:ll6];
        UIButton*bb1=[[UIButton alloc] initWithFrame:CGRectMake(260, 115, 80, 20)];
        [bb1 setTitle:@"取消订单" forState:UIControlStateNormal];
        [bb1 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        bb1.titleLabel.font = [UIFont systemFontOfSize: 14.0];
        [bb1.layer setBorderWidth:1.0]; //边框宽度
        [bb1.layer setBorderColor:[[UIColor blackColor]CGColor]];//边框颜色
        UIButton*bb2=[[UIButton alloc] initWithFrame:CGRectMake(345, 115, 50, 20)];
        bb2.titleLabel.font=[UIFont systemFontOfSize:14.0f];
        [bb2 setTitle:@"付款" forState:UIControlStateNormal];
        [bb2 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        [bb2.layer setBorderWidth:1.0]; //边框宽度
        [bb2.layer setBorderColor:[[UIColor redColor]CGColor]];
        [cell.contentView addSubview:bb1];
        [cell.contentView addSubview:bb2];
        
    }
    
    return cell;
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
